import serve from './index'
// 按需导出

// 获取页码数
export function getPages(name, teacherName, departmentName) {
    return serve({
        url: '/admin/course/page/count',
        method: 'get',
        params: {
            departmentName: departmentName,
            teacherName: teacherName,
            name: name
        }
    })
}

// 编辑详情
export function getLessons(id) {
    return serve({
        url: '/admin/course/'+id,
        method: 'get',
    })
}

// 搜索
export function getList(page, name, teacherName,departmentName ) {
    return serve({
        url: '/admin/course/page/' + page,
        method: 'get',
        params: {
            departmentName: departmentName,
            teacherName: teacherName,
            name: name
        }
    })
}

// 搜索全部教师
export function getListAll() {
    return serve({
        url: '/admin/teacher/names',
        method: 'get',
    })
}

// 添加
export function ADDList(credit, examLocation, grade, location, maxSize, name, teacherId, time, examDate) {
    return serve({
        url: '/admin/course',
        method: 'post',
        data: {
            credit: credit,               //学分
            examLocation: examLocation,   //考试地点
            grade: grade,                 //年级
            location: location,           //上课地点
            maxSize: maxSize,             //最大容量
            teacherId: teacherId,         //授课教师ID
            time: time,                   //时间==上课时间  星期-第几节-时长
            name: name,                   //课程名
            examDate: examDate,           //xxxx
            id: -1,
        }
    })
}

// 更改
export function changeorno(data) {
    return serve({
        url: '/admin/course',
        method: 'put',
        data: data
    })
}

// 删除
export function deleted(id) {
    return serve({
        url: '/admin/department/' + id,
        method: 'delete',
    })
}